package com.zbo;

import com.zbo.mapper.ScMapper;
import com.zbo.pojo.Sc;
import com.zbo.util.SqlSessionFactoryUtils;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

public class test {
    public static void main(String[] args) {
        Sc sc = new Sc();
        sc.setStudentId(1);
        sc.setName("测试课程");
        sc.setDayOfWeek(1);
        sc.setStartTime("08:00:00");
        sc.setEndTime("10:00:00");
        sc.setLocation("测试教室");
        sc.setWeekType(0);

        SqlSessionFactory sqlSessionFactory = SqlSessionFactoryUtils.getSqlSessionFactory();
        SqlSession session = sqlSessionFactory.openSession(true);
        ScMapper mapper = session.getMapper(ScMapper.class);
        mapper.insert(sc);
        session.commit(); // 查看数据库是否插入成功
    }
}
